<template>
  <div class="crumb">
    <el-breadcrumb separator="/">
      <!-- <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
  <el-breadcrumb-item><a href="/">活动管理</a></el-breadcrumb-item> -->
      <el-breadcrumb-item  v-for="item,index in titles" :key="index">{{item}}</el-breadcrumb-item>
      <!-- <el-breadcrumb-item>活动详情</el-breadcrumb-item> -->
    </el-breadcrumb>
  </div>
</template>

<script>
export default {
  data() {
    return {
      //titles值和当前路由有关
      // 路由变化，titles变化
      titles: [],
    };
  },
  watch:{
      $route:{
          immediate:true,
          handler(val,oldval){
              if(val!=oldval){
                  //当前路由 里面有元信息meta（存放路由相关信息）
                //   console.log(val);
                  this.titles=this.$route.meta.titles

              }
          }
      }
  }
};
</script>
 
<style lang = "less" scoped>
.el-breadcrumb {
  height: 50px;
  line-height: 50px !important;
}
</style>